| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Public Attributes | List of all members
nkMaths::IntVector Class Reference

A 4-component vector class, with integers. More...

## Public Member Functions
| IntVector () noexcept
| IntVector (int x, int y) noexcept
| IntVector (int x, int y, int z) noexcept
| IntVector (int x, int y, int z, int w) noexcept
| IntVector (const Vector &other) noexcept
| IntVector (const IntVector &other) noexcept
int | getX () const
int | getY () const
int | getZ () const
int | getW () const
void | setX (int value)
void | setY (int value)
void | setZ (int value)
void | setW (int value)
void | addX (int value)
void | addY (int value)
void | addZ (int value)
void | addW (int value)
void | multX (int value)
void | multY (int value)
void | multZ (int value)
void | multW (int value)
float | getLengthVec2 () const
float | getLengthVec3 () const
float | getLengthVec4 () const
float | getLengthSquaredVec2 () const
float | getLengthSquaredVec3 () const
float | getLengthSquaredVec4 () const
float | getDistanceVec2 (const IntVector &other) const
float | getDistanceVec3 (const IntVector &other) const
float | getDistanceVec4 (const IntVector &other) const
float | getDistanceSquaredVec2 (const IntVector &other) const
float | getDistanceSquaredVec3 (const IntVector &other) const
float | getDistanceSquaredVec4 (const IntVector &other) const
nkMemory::String | toString () const
IntVector & | fromString (nkMemory::StringView str)
IntVector & | operator= (const IntVector &other) noexcept
IntVector & | operator= (const Vector &other) noexcept
IntVector | operator+ (const IntVector &other) const
void | operator+= (const IntVector &other)
IntVector | operator- (const IntVector &other) const
void | operator-= (const IntVector &other)
IntVector | operator* (const IntVector &other) const
void | operator*= (const IntVector &other)
IntVector | operator* (int coeff) const
void | operator*= (int coeff)
IntVector | operator/ (const IntVector &other) const
void | operator/= (const IntVector &other)
IntVector | operator/ (int coeff) const
void | operator/= (int coeff)
bool | operator== (const IntVector &other) const
bool | operator!= (const IntVector &other) const
bool | operator< (const IntVector &other) const
bool | operator<= (const IntVector &other) const
bool | operator> (const IntVector &other) const
bool | operator>= (const IntVector &other) const

## Public Attributes
int | _x
| X component of the vector.
int | _y
| Y component of the vector.
int | _z
| Z component of the vector.
int | _w
| W component of the vector.

## Detailed Description

A 4-component vector class, with integers.

## Constructor & Destructor Documentation

## ◆ IntVector() [1/6]

nkMaths::IntVector::IntVector | ( |  | ) |
| noexcept

Default constructor. Defaults to 0 on each component.

## ◆ IntVector() [2/6]

nkMaths::IntVector::IntVector | ( | int | x,
|  | int | y
| ) |  |
| noexcept

2D constructor.

Parameters

  x | The x component to assign.
  y | The y component to assign.

Remarks
  All other components (z, w) will be set to 0.

## ◆ IntVector() [3/6]

nkMaths::IntVector::IntVector | ( | int | x,
|  | int | y,
|  | int | z
| ) |  |
| noexcept

3D constructor.

Parameters

  x | The x component to assign.
  y | The y component to assign.
  z | The z component to assign.

Remarks
  All other components (w) will be set to 0.

## ◆ IntVector() [4/6]

nkMaths::IntVector::IntVector | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | w
| ) |  |
| noexcept

4D constructor.

Parameters

  x | The x component to assign.
  y | The y component to assign.
  z | The z component to assign.
  w | The w component to assign.

## ◆ IntVector() [5/6]

nkMaths::IntVector::IntVector | ( | const Vector & | other | ) |
| noexcept

Copy constructor.

Parameters

  other | The vector to copy from.

## ◆ IntVector() [6/6]

nkMaths::IntVector::IntVector | ( | const IntVector & | other | ) |
| noexcept

Copy constructor.

Parameters

  other | The vector to copy from.

## Member Function Documentation

## ◆ getX()

int nkMaths::IntVector::getX | ( |  | ) | const

Returns
  The x component.

## ◆ getY()

int nkMaths::IntVector::getY | ( |  | ) | const

Returns
  The y component.

## ◆ getZ()

int nkMaths::IntVector::getZ | ( |  | ) | const

Returns
  The z component.

## ◆ getW()

int nkMaths::IntVector::getW | ( |  | ) | const

Returns
  The w component.

## ◆ setX()

void nkMaths::IntVector::setX | ( | int | value | ) |

Sets the x component.

Parameters

  value | The value to set.

## ◆ setY()

void nkMaths::IntVector::setY | ( | int | value | ) |

Sets the y component.

Parameters

  value | The value to set.

## ◆ setZ()

void nkMaths::IntVector::setZ | ( | int | value | ) |

Sets the z component.

Parameters

  value | The value to set.

## ◆ setW()

void nkMaths::IntVector::setW | ( | int | value | ) |

Sets the w component.

Parameters

  value | The value to set.

## ◆ addX()

void nkMaths::IntVector::addX | ( | int | value | ) |

Adds to the x component.

Parameters

  value | The value to add.

## ◆ addY()

void nkMaths::IntVector::addY | ( | int | value | ) |

Adds to the y component.

Parameters

  value | The value to add.

## ◆ addZ()

void nkMaths::IntVector::addZ | ( | int | value | ) |

Adds to the z component.

Parameters

  value | The value to add.

## ◆ addW()

void nkMaths::IntVector::addW | ( | int | value | ) |

Adds to the w component.

Parameters

  value | The value to add.

## ◆ multX()

void nkMaths::IntVector::multX | ( | int | value | ) |

Multiply the x component.

Parameters

  value | The value to multiply.

## ◆ multY()

void nkMaths::IntVector::multY | ( | int | value | ) |

Multiply the y component.

Parameters

  value | The value to multiply.

## ◆ multZ()

void nkMaths::IntVector::multZ | ( | int | value | ) |

Multiply the z component.

Parameters

  value | The value to multiply.

## ◆ multW()

void nkMaths::IntVector::multW | ( | int | value | ) |

Multiply the w component.

Parameters

  value | The value to multiply.

## ◆ getLengthVec2()

float nkMaths::IntVector::getLengthVec2 | ( |  | ) | const

Returns
  The length of the vector, as if it was a 2D vector.

## ◆ getLengthVec3()

float nkMaths::IntVector::getLengthVec3 | ( |  | ) | const

Returns
  The length of the vector, as if it was a 3D vector.

## ◆ getLengthVec4()

float nkMaths::IntVector::getLengthVec4 | ( |  | ) | const

Returns
  The length of the vector, as if it was a 4D vector.

## ◆ getLengthSquaredVec2()

float nkMaths::IntVector::getLengthSquaredVec2 | ( |  | ) | const

Returns
  The squared length of the vector as if it was a 2D vector.

Remarks
  For simple comparisons allowing it, prefer this function over the simple length as it is more performant.

## ◆ getLengthSquaredVec3()

float nkMaths::IntVector::getLengthSquaredVec3 | ( |  | ) | const

Returns
  The squared length of the vector as if it was a 3D vector.

Remarks
  For simple comparisons allowing it, prefer this function over the simple length as it is more performant.

## ◆ getLengthSquaredVec4()

float nkMaths::IntVector::getLengthSquaredVec4 | ( |  | ) | const

Returns
  The squared length of the vector as if it was a 4D vector.

Remarks
  For simple comparisons allowing it, prefer this function over the simple length as it is more performant.

## ◆ getDistanceVec2()

float nkMaths::IntVector::getDistanceVec2 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The distance between both vectors, as if they were 2D vectors.

## ◆ getDistanceVec3()

float nkMaths::IntVector::getDistanceVec3 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The distance between both vectors, as if they were 3D vectors.

## ◆ getDistanceVec4()

float nkMaths::IntVector::getDistanceVec4 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The distance between both vectors, as if they were 4D vectors.

## ◆ getDistanceSquaredVec2()

float nkMaths::IntVector::getDistanceSquaredVec2 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The squared distance between both vectors, as if they were 2D vectors.

Remarks
  For simple comparisons allowing it, prefer this function over the simple distance as it is more performant.

## ◆ getDistanceSquaredVec3()

float nkMaths::IntVector::getDistanceSquaredVec3 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The squared distance between both vectors, as if they were 3D vectors.

Remarks
  For simple comparisons allowing it, prefer this function over the simple distance as it is more performant.

## ◆ getDistanceSquaredVec4()

float nkMaths::IntVector::getDistanceSquaredVec4 | ( | const IntVector & | other | ) | const

Parameters

  other | The vector to check the distance with.

Returns
  The squared distance between both vectors, as if they were 4D vectors.

Remarks
  For simple comparisons allowing it, prefer this function over the simple distance as it is more performant.

## ◆ toString()

nkMemory::String nkMaths::IntVector::toString | ( |  | ) | const

Returns
  The vector expressed as a string, formatted as "x, y, z, w".

## ◆ fromString()

IntVector& nkMaths::IntVector::fromString | ( | nkMemory::StringView | str | ) |

Parse components from a string representation. Format is "x,y,z,w".

Parameters

  str | The string to parse.

## ◆ operator=() [1/2]

IntVector& nkMaths::IntVector::operator= | ( | const IntVector & | other | ) |
| noexcept

Assignment operator.

Parameters

  other | The vector to overwrite from.

Returns
  The calling vector, updated.

## ◆ operator=() [2/2]

IntVector& nkMaths::IntVector::operator= | ( | const Vector & | other | ) |
| noexcept

Assignment operator.

Parameters

  other | The vector to overwrite from.

Returns
  The calling vector, updated.

## ◆ operator+()

IntVector nkMaths::IntVector::operator+ | ( | const IntVector & | other | ) | const

Addition operator.

Parameters

  other | The vector to operate with.

Returns
  A result vector, after operation application.

## ◆ operator+=()

void nkMaths::IntVector::operator+= | ( | const IntVector & | other | ) |

Addition and assignment operator.

Parameters

  other | The vector to operate with.

## ◆ operator-()

IntVector nkMaths::IntVector::operator- | ( | const IntVector & | other | ) | const

Subtraction operator.

Parameters

  other | The vector to operate with.

Returns
  A result vector, after operation application.

## ◆ operator-=()

void nkMaths::IntVector::operator-= | ( | const IntVector & | other | ) |

Subtraction and assignment operator.

Parameters

  other | The vector to operate with.

## ◆ operator*() [1/2]

IntVector nkMaths::IntVector::operator* | ( | const IntVector & | other | ) | const

Multiplication operator.

Parameters

  other | The vector to operate with.

Returns
  A result vector, after operation application.

## ◆ operator*=() [1/2]

void nkMaths::IntVector::operator*= | ( | const IntVector & | other | ) |

Multiplication and assignment operator.

Parameters

  other | The vector to operate with.

## ◆ operator*() [2/2]

IntVector nkMaths::IntVector::operator* | ( | int | coeff | ) | const

Multiplication operator.

Parameters

  coeff | The scalar to operate with.

Returns
  A result vector, after operation application on all components.

## ◆ operator*=() [2/2]

void nkMaths::IntVector::operator*= | ( | int | coeff | ) |

Multiplication and assignment operator.

Parameters

  coeff | The scalar to operate with.

## ◆ operator/() [1/2]

IntVector nkMaths::IntVector::operator/ | ( | const IntVector & | other | ) | const

Division operator.

Parameters

  other | The vector to operate with.

Returns
  A result vector, after operation application.

## ◆ operator/=() [1/2]

void nkMaths::IntVector::operator/= | ( | const IntVector & | other | ) |

Division and assignment operator.

Parameters

  other | The vector to operate with.

## ◆ operator/() [2/2]

IntVector nkMaths::IntVector::operator/ | ( | int | coeff | ) | const

Division operator.

Parameters

  coeff | The scalar to operate with.

Returns
  A result vector, after operation application on all components.

## ◆ operator/=() [2/2]

void nkMaths::IntVector::operator/= | ( | int | coeff | ) |

Division and assignment operator.

Parameters

  coeff | The scalar to operate with.

## ◆ operator==()

bool nkMaths::IntVector::operator== | ( | const IntVector & | other | ) | const

Equality operator.

Parameters

  other | The vector to check against.

Returns
  If the vectors are equal (true) or not (false).

## ◆ operator!=()

bool nkMaths::IntVector::operator!= | ( | const IntVector & | other | ) | const

Inequality operator.

Parameters

  other | The vector to check against.

Returns
  If the vectors are inequal (true) or not (false).

## ◆ operator<()

bool nkMaths::IntVector::operator< | ( | const IntVector & | other | ) | const

Less than operator.

Parameters

  other | The vector to check against.

Returns
  If the calling vector is smaller (true) or not (false).

## ◆ operator<=()

bool nkMaths::IntVector::operator<= | ( | const IntVector & | other | ) | const

Less than or equal operator.

Parameters

  other | The vector to check against.

Returns
  If the calling vector is smaller, equal (true) or not (false).

## ◆ operator>()

bool nkMaths::IntVector::operator> | ( | const IntVector & | other | ) | const

Greater than operator.

Parameters

  other | The vector to check against.

Returns
  If the calling vector is greater (true) or not (false).

## ◆ operator>=()

bool nkMaths::IntVector::operator>= | ( | const IntVector & | other | ) | const

Greater than or equal operator.

Parameters

  other | The vector to check against.

Returns
  If the calling vector is greater, equal (true) or not (false).

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsMaths/Algebra/IntVector.h